package com.base.controller;

import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import com.base.po.voip.Agentinfoes;
import com.base.service.AgentinfoesService;

/**
 * 紧急控制信息服务端
 * 
 * @author f
 *
 */
@Controller
@RequestMapping("/admin")
public class index_Urgent {

	@Autowired
	private AgentinfoesService agentinfoesService; // 紧急控制信息

	// 紧急控制首页
	@RequestMapping("/urgentIndex")
	public ModelAndView urgentIndex(HttpServletRequest request) throws Exception {
		String userid = (String) request.getSession().getAttribute("adminUserId"); // 登录的用户ID
		if (userid == null) return new ModelAndView("jsp/loginCheck"); // 未登录
		return new ModelAndView("jsp/index_Urgent", "agentinfoes",
				agentinfoesService.selectByAll(new Agentinfoes(userid, true)));
	}

	// 跳转添加紧急信息
	@RequestMapping("/addUrgent")
	public String addUrgent() throws Exception {
		return "jsp/add_Urgent";
	}

	// 跳转修改紧急信息
	@RequestMapping("/updateUrgent")
	public ModelAndView updateUrgent(String id) throws Exception {
		return new ModelAndView("jsp/update_Urgent", "agentinfoes", agentinfoesService.selectByPrimaryKey(id));
	}
}
